<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <base herf="<%=basePath%>">
    <link href="<%=basePath%>static2/assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="<%=basePath%>static2/css/style.css"/>
    <link href="<%=basePath%>static2/assets/css/codemirror.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=basePath%>static2/assets/css/ace.min.css"/>
    <link rel="stylesheet" href="<%=basePath%>static2/assets/css/font-awesome.min.css"/>

    <script src="<%=basePath%>static2/assets/js/jquery.min.js"></script>

    <script type="text/javascript">
        window.jQuery || document.write("<script src='<%=basePath%>static2/assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
    </script>


    <script type="text/javascript">
        if ("ontouchend" in document) document.write("<script src='<%=basePath%>static2/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
    </script>
    <script src="<%=basePath%>static2/assets/js/bootstrap.min.js"></script>
    <script src="<%=basePath%>static2/assets/js/typeahead-bs2.min.js"></script>
    <!-- page specific plugin scripts -->
    <script src="<%=basePath%>static2/assets/js/jquery.dataTables.min.js"></script>
    <script src="<%=basePath%>static2/assets/js/jquery.dataTables.bootstrap.js"></script>
    <script type="text/javascript" src="<%=basePath%>static2/js/H-ui.js"></script>
    <script type="text/javascript" src="<%=basePath%>static2/js/H-ui.admin.js"></script>
    <script src="<%=basePath%>static2/assets/layer/layer.js" type="text/javascript"></script>
    <script src="<%=basePath%>static2/assets/laydate/laydate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {

        });

        function member_del(obj, id) {
            //alert("zhixingledianji");
            layer.confirm('确认要删除吗？', function (index) {
                $.ajax({
                    type: "POST",
                    url: "../goods/deleteGoods",
                    data: {goodsid: id},
                    dataType: "json",
                    success: function (data) {
                    }
                });
                $(obj).parents("tr").remove();
                layer.msg('已删除!', {icon: 1, time: 1000});
            });
        }

        function openadd(goodsId, goodsName, price,stock) {
            window.location.href = '${pageContext.request.contextPath}/jsp/admin/regoods.jsp?goodsId=' + goodsId + '&goodsName=' + goodsName + '&price=' + price
            +'&stock='+stock;
        }

    </script>
    <title>用户列表</title>
</head>

<body>
<div class="page-content clearfix">
    <div id="Member_Ratings">
        <div class="d_Confirm_Order_style">
            <%--<div class="search_style">
                <form action="<%=basePath%>goods/goods_list" class="input-group">
                    <ul class="search_content clearfix">
                        <li><label class="l_f">商品名称</label>
                            <input name="goods_dimSearch" type="text" class="text_add" placeholder="输入商品名称"
                                   style="width: 400px"/></li>
                        <li style="width: 90px;">
                            <button type="submit"
                                    class="btn_search">
                                <i class="icon-search"></i>查询
                            </button>
                        </li>
                    </ul>
                </form>
            </div>--%>
            <!---->
            <div class="border clearfix">
					<%--<span class="l_f">
						<a href="<%=basePath%>jsp/admin/addgoods.jsp" id="member_add" class="btn btn-warning">
							<i class="icon-plus"></i>添加商品</a>
					</span>--%>
	<div class="page-content clearfix">
		<div id="Member_Ratings">
			<div class="d_Confirm_Order_style">
				<div class="search_style">
					<form action="<%=basePath%>goods/DimSearch" class="input-group">
						<ul class="search_content clearfix">
							<li><label class="l_f">商品名称</label><input name="goods_dimSearch"
								type="text" class="text_add" placeholder="输入商品名称"
								style="width: 400px" /></li>
							<%--<li style="width: 90px;"><button type="submit"
									class="btn_search">
									<i class="icon-search"></i>查询
								</button></li>--%>
						</ul><input type="submit" value="查询">
					</form>
				</div>
				<!---->
				<div class="border clearfix">
					<a href="${pageContext.request.contextPath}/jsp/admin/addgoods.jsp">+添加商品</a>
<%--					<span class="l_f" onclick="openadd()"> <i class="icon-plus"></i>添加商品</span> --%>
					<span class="r_f">共：<b>${userCount } </b>条
					</span>
            </div>
            <!---->
            <div class="table_menu_list">
                <table class="table table-striped table-bordered table-hover"
                       id="sample-table">
                    <thead>
                    <tr>
                        <th width="25"><label><input type="checkbox"
                                                     class="ace"><span class="lbl"></span></label></th>
                        <th width="80">ID</th>
                        <th width="100">barCode</th>
                        <th width="120">类型</th>
                        <th width="120">类型号</th>
                        <th width="150">名称</th>
                        <th width="120">进价</th>
                        <th width="120">售价</th>

                        <th width="120">库存</th>
                        <th width="120">图片</th>
                        <th width="120">创建时间</th>
                        <th width="120">更新时间</th>
                        <th width="250">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${goodsList}" var="good">
                        <div>
                            <tr>
                                <td><label><input type="checkbox" class="ace"><span
                                        class="lbl"></span></label></td>
                                <td>${good.goodsId}</td>
                                <td><u style="cursor: pointer" class="text-primary"
                                       onclick="member_show('张三','member-show.html','10001','500','400')">${good.barCode }</u>
                                </td>
                                <td>${good.goodsTitle}</td>
                                <td>${good.goodsCateId }</td>
                                <td>${good.goodsName}</td>
                                <td>${good.goodsBrand}</td>
                                <td>${good.price}</td>
                                <td>${good.goodsStock }</td>
                                <td><img src="<%=basePath%>${good.goodsImg}" alt="${good.goodsTitle }" class="cover"
                                         width="40"></td>
                                <td><fmt:formatDate value="${good.createTime }" pattern="yyyy-MM-dd HH:mm:ss "/></td>
                                <td><fmt:formatDate value="${good.updateTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                <td class="td-manage"><span title="修改商品信息"
                                                            onclick="openadd('${good.goodsId}','${good.goodsName }','${good.price }','${good.goodsStock}')"
                                                            class="btn btn-xs btn-info">
                                    <i class="icon-edit bigger-120"></i></span>
                                    <a title="删除" href="javascript:;" onclick="member_del(this,'${good.goodsId }')" class="btn btn-xs btn-warning">
                                        <i class="icon-trash  bigger-120"></i></a></td>
                            </tr>
                        </div>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

</body>
</html>
